package com.foreknow.demo16;

public class Thread1 implements Runnable {
    @Override
    public void run() {
        synchronized (WaitSleepDemo.class){
            System.out.println("进入线程Thread1");
            System.out.println("Thread1 is waiting");
            try {
                //调用wait（）方法,线程会放弃对象锁，进入等待此对象的锁定池中
                WaitSleepDemo.class.wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("线程Thread1继续执行");
            System.out.println("Thread1执行结束了......");
        }
    }
}
